﻿using System.Diagnostics.Contracts;
#if !WINDOWS_PHONE
using System.Threading;
using System.Threading.Tasks;
#endif

namespace System.Reactive.Linq
{
	public static partial class Observable
	{
		public static IObservable<TSource> Using<TSource, TResource>(Func<TResource> resourceFactory, Func<TResource, IObservable<TSource>> observableFactory)
			where TResource : IDisposable
		{
			Contract.Requires(resourceFactory != null, null, "resourceFactory != null");
			Contract.Requires(observableFactory != null, null, "observableFactory != null");
			Contract.Ensures(Contract.Result<IObservable<TSource>>() != null, null, "Contract.Result<IObservable<TSource>>() != null");
			return null;
		}

#if !WINDOWS_PHONE
		public static IObservable<TSource> UsingAsync<TSource, TResource>(Func<CancellationToken, Task<TResource>> resourceFactoryAsync, Func<TResource, CancellationToken, Task<IObservable<TSource>>> observableFactoryAsync)
			where TResource : IDisposable
		{
			Contract.Requires(resourceFactoryAsync != null, null, "resourceFactoryAsync != null");
			Contract.Requires(observableFactoryAsync != null, null, "observableFactoryAsync != null");
			Contract.Ensures(Contract.Result<IObservable<TSource>>() != null, null, "Contract.Result<IObservable<TSource>>() != null");
			return null;
		}
#endif
	}
}